package lambda;

import java.util.Arrays;
import java.util.function.Function;

public class ArrayReference {
    public static void main(String[] args) {
        // 转换函数式引用
        Function<Integer,int[]> function1 = new Function<Integer, int[]>() {
            @Override
            public int[] apply(Integer integer) {
                return new int[integer];
            }
        };
        System.out.println(Arrays.toString(function1.apply(10)));

        Function<Integer,int[]> function2 = (i) ->new int[i];
        System.out.println(Arrays.toString(function2.apply(10)));

        Function<Integer,int[]> function3 = int[]::new;
        System.out.println(Arrays.toString(function3.apply(10)));
    }
}
